package cc.magicjson.example.demo.ali.util;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.Reader;

public class FileUtils {

    //使用缓存字符流读取文件
    public static String readBufferFile(String mSrcName) {
        StringBuilder stringBuilder = new StringBuilder();
        String line;
        try (Reader reader = new FileReader(mSrcName);
             BufferedReader buffReader = new BufferedReader(reader);) {
            while ((line = buffReader.readLine()) != null) {
                stringBuilder.append(line + '\n');
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return stringBuilder.toString();
    }
}
